<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<sfa:mainTitle></sfa:mainTitle>
<%@ include file="../../common/meta.jsp"%>

<script type="text/javascript">

jQuery.validator.addMethod("loginname", function(value, element) {   
    var tel = /^[a-zA-Z][a-zA-Z0-9_]{4,16}$/;
    return this.optional(element) || (tel.test(value));
}, "");

jQuery.validator.addMethod("password", function(value, element) {   
    var tel = /^[\da-zA-Z=\[\];`',.\/~!@#$%^&*()_+|{}:"<>?]{4,16}$/;
    return this.optional(element) || (tel.test(value));
}, "");

jQuery.validator.addMethod("phonenumber", function(value, element) {   
    var tel = /^(13[0-9]|15[0|3|6|7|8|9]|18[3|6|7|8|9])\d{8}$/;
    return this.optional(element) || (tel.test(value));
}, "");

$(function() {
	$(document).ready(function(){
	$("#clear").click(function(){
		$(".inputbox").val("");
	});
	
	
	
	$("#updateForm").validate( {
		rules : {
			userPassword:{
				required:true,
				rangelength: [5,16],
				password:true
			},
			newpassword:{
				required : true,
				rangelength: [5,16],
				password:true
			},
			newpassword2:{
				required : true,
				equalTo:"#newpassword"
			},
			username:{
			required : true
			},
			email:{
			required : true,
			email:true
			},
			contactMobile:{
			phonenumber:true
			}
			
		},
		 messages:{
                userPassword:{required:"",rangelength:"",password:""},
                newpassword:{required:"",rangelength:"",password:""},
                newpassword2:{required:"",rangelength:"",equalTo:""},
                username:{required:""},
                email:{required:"",email:""},
                contactMobile:{required:"",phonenumber:""},
                focusInvalid: false,   
 				onkeyup: false //获得焦点时不验证
 				}
	});
});

});
</script>
</head>



<body id="master">

	<sfa:mainHeader></sfa:mainHeader>
	
	 
	<div class="main">
			<span class="pageTitle"> 修改密码 <font color="red"><c:out value="${update}"></c:out> </font></span>
			<input type="button" class="com_new" value="返回"
				onclick="javascript:history.go(-1);">
			<hr />
	<div class="in">
	<c:set value="${currentUser}" var="curUser"></c:set>
	<form action="${path }/users/users/index/update" method="post" id="updateForm">

	<div class="formdiv clear">
						<span>用户：${curUser.userName}(${curUser.loginName})</span>
						<br>
						
						<input type="hidden" id="loginName" class="inputbox" name="loginName" value="${ curUser.loginName}"/>
						<input type="hidden" id="saleUsersLoginId" class="inputbox" name="saleUsersLoginId" value="${ curUser.saleUsersLoginId}"/>
						<font color="red">${name }</font>
	</div>
	
	<div class="formdiv clear">
						<span>旧密码：</span>
						<br/>
						<input type="password" id="userPassword" class="inputbox" name="userPassword" value="${userpassword}"/>
						*长度为5到16位，由字母，数字，特殊字符组成<font color="red">${pass }</font>
	</div>
	
	<div class="formdiv clear">
						<span>新密码：</span>
						<br>
						<input type="password" id="newpassword" class="inputbox" name="newpassword" value="${newPassword}"/>
						*长度为5到16位，由字母，数字，特殊字符组成<font color="red">${password1 }</font>
	</div>
		
		<div class="formdiv clear">
						<span>重复新密码：</span>
						<br>
						<input type="password" id="newpassword2" class="inputbox" name="newpassword2" value="${newPassword2}" />
						*与新密码的值相同<font color="red">${password2 }</font>
	</div>
	<div class="formdiv clear">
						<span>姓名：</span>
						<br>
						<input type="text" id="username" class="inputbox" name="username" value="${curUser.userName}"/>
						*<font color="red">${userName }</font>
	</div>
	
	<div class="formdiv clear">
						<span>电子邮件：</span>
						<br>
						<input type="text" id="email" class="inputbox" name="email" value="${curUser.email}"/>
						*格式如：xxxx@xx.com<font color="red">${email }</font>
	</div>
	
	<div class="formdiv clear">
						<span>手机号码：</span>
						<br>
						<input type="text" id="contactMobile" class="inputbox" name="contactMobile" value="${curUser.contactMobile}"/>
						格式如：138********<font color="red">${contact}</font>
	</div>
			
	<div class="formdiv clear">
						<p>
							<input name="submit" type="submit" id="submit" tabindex="5"
								class="com_btn" value="提交">
							<input name="clear" type="button" id="clear" tabindex="5"
								class="com_btn" value="清空">
						</p>
					</div>	
	</form>
	</div>
	</div>
	<sfa:mainFooter></sfa:mainFooter>
</body>
</html>


